package com.edgegateway.system.service.impl;

import java.util.List;
import com.edgegateway.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.edgegateway.system.mapper.IotThingsModelMapper;
import com.edgegateway.system.domain.IotThingsModel;
import com.edgegateway.system.service.IIotThingsModelService;
import com.edgegateway.common.core.text.Convert;

/**
 * 物模型Service业务层处理
 * 
 * @author Doooxu
 * @date 2023-01-11
 */
@Service
public class IotThingsModelServiceImpl implements IIotThingsModelService 
{
    @Autowired
    private IotThingsModelMapper iotThingsModelMapper;

    /**
     * 查询物模型
     * 
     * @param modelId 物模型主键
     * @return 物模型
     */
    @Override
    public IotThingsModel selectIotThingsModelByModelId(String modelId)
    {
        return iotThingsModelMapper.selectIotThingsModelByModelId(modelId);
    }

    /**
     * 查询物模型列表
     * 
     * @param iotThingsModel 物模型
     * @return 物模型
     */
    @Override
    public List<IotThingsModel> selectIotThingsModelList(IotThingsModel iotThingsModel)
    {
        return iotThingsModelMapper.selectIotThingsModelList(iotThingsModel);
    }

    /**
     * 新增物模型
     * 
     * @param iotThingsModel 物模型
     * @return 结果
     */
    @Override
    public int insertIotThingsModel(IotThingsModel iotThingsModel)
    {
        iotThingsModel.setCreateTime(DateUtils.getNowDate());
        return iotThingsModelMapper.insertIotThingsModel(iotThingsModel);
    }

    /**
     * 修改物模型
     * 
     * @param iotThingsModel 物模型
     * @return 结果
     */
    @Override
    public int updateIotThingsModel(IotThingsModel iotThingsModel)
    {
        iotThingsModel.setUpdateTime(DateUtils.getNowDate());
        return iotThingsModelMapper.updateIotThingsModel(iotThingsModel);
    }

    /**
     * 批量删除物模型
     * 
     * @param modelIds 需要删除的物模型主键
     * @return 结果
     */
    @Override
    public int deleteIotThingsModelByModelIds(String modelIds)
    {
        return iotThingsModelMapper.deleteIotThingsModelByModelIds(Convert.toStrArray(modelIds));
    }

    /**
     * 删除物模型信息
     * 
     * @param modelId 物模型主键
     * @return 结果
     */
    @Override
    public int deleteIotThingsModelByModelId(String modelId)
    {
        return iotThingsModelMapper.deleteIotThingsModelByModelId(modelId);
    }
}
